package by.demchenko.sample.webapp.page.home.panel;

import by.demchenko.sample.datamodel.Course;
import by.demchenko.sample.webapp.page.home.cards.CourseCard;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;

public class CoursePanel extends Panel {

    public CoursePanel(String id, Course course) {
        super(id);

        Link linkCourse = new Link("course") {
            @Override
            public void onClick() {
                setResponsePage(new CourseCard(course));
            }
        };
        linkCourse.add(new Label("course_text", course.getName()));
        add(linkCourse);

        //add(new Label("course", new Model<>(course.getName())));
        add(new TeacherPanel("teacher", course.getTeacher()));
        add(new Label("description", new Model<>(course.getDescription())));
    }
}
